package com.heima.utils.thread;


import com.heima.model.user.pojos.ApUser;

public class AppThreadLocalUtil {
    public static final ThreadLocal<ApUser> APP_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 向ThreadLocal中存入数据
     */
    public static void setUser(ApUser apUser){
        APP_THREAD_LOCAL.set(apUser);
    }

    /**
     * 从ThreadLocal中获取数据
     */
    public static ApUser getUser(){
        return APP_THREAD_LOCAL.get();
    }

    /**
     * 清除ThreadLocal中的数据
     */
    public static void clear(){
        APP_THREAD_LOCAL.remove();
    }
}
